<template>
  <section>
    <div class="model mymanage">
      <img :src="IMGBASE64.WODEXINXI2X" class="pink">
      <span class="title">学校管理</span>
      <div class="body">
				<div class="content">
					<div class="header">
						<span>学校名称：</span>
						<span>{{schoolMsg.schoolName}}</span>
					</div>
					<div class="left">
						<span>联系人：</span>
						<span>{{schoolMsg.linkName}}</span>
						<!-- <input type="text" :class="{'text1' : dis1, 'text2' : dis2}" v-model="phoneMaster" :disabled="notInput"> -->
					</div>
					<div class="right">
						<span>手机号：</span>
						<span>{{schoolMsg.telphone1}}</span>
						<!-- <input type="text" :class="{'text1' : dis1, 'text2' : dis2}" v-model="phone" :disabled="notInput"> -->
					</div>
					<div class="left">
						<span>学校类型：</span>
						<span>{{schoolMsg.schoolType}}</span>
					</div>
					<div class="right">
						<span>签约时间：</span>
						<span>{{schoolMsg.createTime2}}</span>
					</div>
					<div class="bottom">
						<span>学校地址：</span>
						<span>{{schoolMsg.schoolAddr}}</span>
						<!-- <input type="text" :class="{'text1' : dis1, 'text2' : dis2}" v-model="homeAddr" :disabled="notInput"> -->
					</div>
					<!-- <div class="bottom">
						<span>登录地址：</span>
						<span>{{schoolMsg.loginAddress}}</span>
					</div> -->
				</div>
				<div class="erweima">
					<img :src="schoolMsg.logoUrl">
				</div>
      </div>
    	<div class="bto-btn">
    		<button class="btn btn-danger" @click="keepDis" v-show="button">保存</button>
    	</div>
    </div>
  </section>
</template>

<script>
export default {
  data () {
    return {
      name: '欧阳俊逸',
      phoneMaster: '444444444444444444',
      phone: '88888888888',
      type: '五年级',
      time: '体育',
      loginAddress: '中国',
      homeAddr: 'asdasd',
      schoolMsg: {},
      notInput: true,
      dis1: true,
      dis2: false,
      button: false,
      icon: true
    }
  },
  mounted () {
    this.getData()
  },
  methods: {
    getData () {
      // let _cookie = document.cookie.split(';')
      // let _cookieArray = []
      // _cookie.forEach(v => {
      //   let _d = v.split('=')
      //   _cookieArray.push({
      //     key: _d[0],
      //     value: _d[1]
      //   })
      // })
      this.$http.post(this._httpUrl + 'schoolConf/info/query', {}, {'headers': {'yxt-xtoken': localStorage.xtoken}}).then(function (response) {
        if (response.body.code === '000') {
          this.schoolMsg = response.data.data
          this.schoolMsg.createTime2 = this.changeTime(this.schoolMsg.createTime)
          if (this.schoolMsg.schoolType === 1) {
            this.schoolMsg.schoolType = '私立'
          } else {
            this.schoolMsg.schoolType = '公立'
          }
          if (this.schoolMsg.status === 0) {
            this.schoolMsg.status = '服务停止'
          } else if (this.schoolMsg.status === 1) {
            this.schoolMsg.status = '正常'
          } else {
            this.schoolMsg.status = '欠费'
          }
        } else if (response.body.code === '887') {
          this.$router.push('/')
        } else if (response.body.code === '889') {
          this.$router.push('/')
        }
      })
    },
    changeDis () {
      this.notInput = !this.notInput
      this.dis1 = !this.dis1
      this.dis2 = !this.dis2
      this.button = !this.button
      this.icon = !this.icon
    },
    keepDis () {
      this.notInput = !this.notInput
      this.dis1 = !this.dis1
      this.dis2 = !this.dis2
      this.button = !this.button
      this.icon = !this.icon
    },
    changeTime (value) {
      if (value != null) {
        var date = new Date(value)
        return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()
      } else {
        return ''
      }
    }
  }
}
</script>

<style lang="less" scoped>
@import '/static/css/all-use.css';
@import '/static/css/material-dashboard.css';
  .mymanage{
		.body{
			position: relative;
		  .content{
		  	width: 80%;
		  	display: inline-block;
		  	span{
		  		font-size: 16px;
		  		color: #222;
		  	}
		  	.header{
		  		width: 100%;
		  		display: inline-block;
		  		padding: 10px 0;
		  	}
		  	.left{
		  		width: 40%;
		  		display: inline-block;
		  		padding: 10px 0;
		  	}
		  	.right{
		  		width: 40%;
					display: inline-block;
					padding: 10px 0;
					margin-left: 5%;
		  	}
		  	.bottom{
		  		padding: 10px 0;
		  		.text{
		  			width: 68%;
		  		}
		  	}
		  	.text1{
		  		background: #fff;
		  		border: 0;
		  		font-size: 16px;
		  		color: #222;
		  	}
		  	.text2{
		  		border: 0;
		  		border-bottom: 1px solid #D7D7D7;
		  		font-size: 16px;
		  		color: #222;
		  	}
		  }
		  .erweima{
		  	width: 19%;
		  	height: 220px;
		  	position: absolute;
		  	top: 38px;
		  	right: 5%;
		  }
		}
	}
	.bto-btn{
		text-align: center;
		padding: 15px 0;
	}

	.xiugai{
		position: absolute;
		right: 20px;
	}
</style>
